#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Behavior.h"
#include "InteractionFragment.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Action;
class Gate;
class InteractionFragment;
class Lifeline;
class Message;

/// <summary>
/// Interaction
/// An Interaction is a unit of Behavior that focuses on the observable exchange of
/// information between connectable elements.
/// </summary>
class UMLMODEL_EXPORT Interaction : public InteractionFragment, public Behavior {

public: // Constructors and destructors
    explicit Interaction(const QString& umlType="uml::Interaction");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// actions getter
    /// Actions owned by the Interaction.
    /// </summary>
    vector<shared_ptr<Action>>& actions();

    /// <summary>
    /// formalGates getter
    /// Specifies the gates that form the message interface between this Interaction and
    /// any InteractionUses which reference it.
    /// </summary>
    vector<shared_ptr<Gate>>& formalGates();

    /// <summary>
    /// fragments getter
    /// The ordered set of fragments in the Interaction.
    /// </summary>
    vector<shared_ptr<InteractionFragment>>& fragments();

    /// <summary>
    /// lifelines getter
    /// Specifies the participants in this Interaction.
    /// </summary>
    vector<shared_ptr<Lifeline>>& lifelines();

    /// <summary>
    /// messages getter
    /// The Messages contained in this Interaction.
    /// </summary>
    vector<shared_ptr<Message>>& messages();

private: // Fields
    /// <summary>
    /// actions
    /// Actions owned by the Interaction.
    /// </summary>
    vector<shared_ptr<Action>> actions_;

    /// <summary>
    /// formalGates
    /// Specifies the gates that form the message interface between this Interaction and
    /// any InteractionUses which reference it.
    /// </summary>
    vector<shared_ptr<Gate>> formalGates_;

    /// <summary>
    /// fragments
    /// The ordered set of fragments in the Interaction.
    /// </summary>
    vector<shared_ptr<InteractionFragment>> fragments_;

    /// <summary>
    /// lifelines
    /// Specifies the participants in this Interaction.
    /// </summary>
    vector<shared_ptr<Lifeline>> lifelines_;

    /// <summary>
    /// messages
    /// The Messages contained in this Interaction.
    /// </summary>
    vector<shared_ptr<Message>> messages_;

};

} // namespace uml
